<script setup>
const props = defineProps({
  modelValue: { type: Object, default: () => ({}) },
  rootForm: { type: Object, default: () => ({}) },
  options: { type: Object, default: () => ({}) },
  disabled: Boolean
})

const emit = defineEmits(['update:modelValue'])

// 表单处理
const formRef = ref()
const form = computed({
  get() {
    return props.modelValue
  },
  set(val) {
    emit('update:modelValue', val)
  }
})
const validate = async () => {
  return new Promise(resolve => {
    formRef?.value.validate((valid, fields) => {
      resolve({ model: 'proveTk', name: '商务条款', success: valid, message: fields })
    })
  })
}

const clearValidate = () => {
  formRef?.value?.clearValidate()
}
const resetFields = () => {
  formRef?.value?.resetFields()
}
defineExpose({ validate, clearValidate, resetFields, formRef })
</script>

<template>
  <el-form ref="formRef" :model="form" label-position="top" :disabled="disabled">
    <div class="v-title mb-3">附件信息</div>
    <el-form-item label="" prop="qa_protocol">
      <VUpload v-model="form.qa_protocol" title="质保协议" multiple :types="['jpg', 'jpeg', 'png', 'pdf']" />
    </el-form-item>
    <el-form-item label="" prop="purchase_contact">
      <VUpload v-model="form.purchase_contact" title="采购框架合同" multiple :types="['jpg', 'jpeg', 'png', 'pdf']" />
    </el-form-item>
    <el-form-item label="" prop="honest_protocol">
      <VUpload v-model="form.honest_protocol" title="廉洁协议" multiple :types="['jpg', 'jpeg', 'png', 'pdf']" />
    </el-form-item>
  </el-form>
</template>
